//
//  OrderZhifuCell.m
//  danpin
//
//  Created by chuangjia on 27/10/2015.
//  Copyright © 2015 chuangjia. All rights reserved.
//

#import "OrderZhifuCell.h"
#import "RadioBox.h"
@interface OrderZhifuCell ()
{
    
}
@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UIView *lineview;

@property(nonatomic,strong)UILabel *phoneLabel;
@property(nonatomic,strong)RadioBox *radioBox;

@end
@implementation OrderZhifuCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.backgroundColor=[UIColor clearColor];
        
        _nameLabel =[[UILabel alloc] initWithFrame:CGRectMake(0,0, DEVICE_WIDTH/2,20)];
        _nameLabel.backgroundColor = [UIColor clearColor];
        _nameLabel.textColor = CONTEXT_COLOR;
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        _nameLabel.font = FONT(12);
        [self.contentView addSubview:_nameLabel];
        
        _lineview =[[UIView alloc] initWithFrame:CGRectZero];
        _lineview.backgroundColor=UIColorFromRGB(0xe5e5e5);
        [self.contentView addSubview:_lineview];
        
        _phoneLabel =[[UILabel alloc] initWithFrame:CGRectMake(0,0, DEVICE_WIDTH/2,20)];
        _phoneLabel.backgroundColor = [UIColor clearColor];
        _phoneLabel.textColor = TITLE_COLOR;
        _phoneLabel.textAlignment = NSTextAlignmentLeft;
        _phoneLabel.font = FONT(13);
        [self.contentView addSubview:_phoneLabel];
        
        _radioBox =[[RadioBox alloc] initWithFrame:CGRectMake(12, 18, 100, 25)];
        //可视化实现
        _radioBox.value = 0;
        _radioBox.on = YES;
        [self.contentView addSubview:_radioBox];
        
    }
    return self;
}
-(void)dealloc
{
    self.actionBlock =nil;
    self.data=nil;
    self.indexPath=nil;
    self.other=nil;
    self.key=nil;
    
    [self.nameLabel removeFromSuperview];
    self.nameLabel=nil;
    [self.phoneLabel removeFromSuperview];
    self.phoneLabel=nil;

    self.lineview=nil;
    
    //    DLog(@"%s", __PRETTY_FUNCTION__);
}
- (void)drawRect:(CGRect)rect {
    
    [super drawRect:rect];
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
}
/// 根据数据模型来显示内容
- (void)showInfo:(id)model key:(id)key indexPath:(NSIndexPath *)indexPath
{
    self.key =key;
    self.indexPath=indexPath;
//    NSDictionary *dict =(NSDictionary*)model;
    
    self.data =model;
    _nameLabel.text =@"支付方式";
    _nameLabel.frame =CGRectMake(PHOTO_FRAME_WIDTH, 0,DEVICE_WIDTH, 40);
    //
    _lineview.frame =CGRectMake(0, 39.5,DEVICE_WIDTH, 0.5);
    //
    _phoneLabel.text =@"支付宝";
    _phoneLabel.frame =CGRectMake(PHOTO_FRAME_WIDTH, 50,DEVICE_WIDTH, 20);
 
    _radioBox.frame =CGRectMake(DEVICE_WIDTH -30, 50,20, 20);
    [self layoutSubviews];
}
-(void)setCallBack:(void(^)(BEventType,UIView*,id,id,NSIndexPath *))callback
{
    self.actionBlock=callback;
}
/// 返回Cell高度
+ (CGFloat)returnCellHeight:(id)model
{
    return PHOTO_FRAME_WIDTH*8;
}

@end
